﻿using System;
using System.Drawing;

namespace Simple3DRedactor.Domain
{
    [Serializable]
    public abstract class Geometry : SceneObject
    {
        protected Geometry()
        {
            Name = "Geometry";
            Material = new Material {Diffuse = Color.White};
        }

        private Material _material;
        public Material Material
        {
            get { return _material; }
            set
            {
                if (_material != value)
                {
                    var oldVal = _material;
                    var newVal = _material = value;

                    oldVal.Change -= OnChange;
                    newVal.Change += OnChange;

                    OnChange();
                }
            }
        }

        private Texture _texture;
        public Texture Texture
        {
            get { return _texture; }
            set
            {
                if (_texture != value)
                {
                    _texture = value;
                    OnChange();
                }
            }
        }
    }
}
